<template>
  <div className="about">
    <h1>This is an about page</h1>
    <h2>这是home发射过来的name:{{ newname }}</h2>
    <span>{{$route.query.param}}</span>
    <slot>默认插槽</slot>
    <slot :twoData="twoData">插槽</slot>
    <slot name="to">
      <h1>插槽to</h1>
    </slot>
  </div>
</template>

<script>
import EventBus from '@/js/eventBus'

export default {
  name: "About",
  data() {
    return {
      newname: "李四",
      twoData: '你好'
    };
  },
  created() {
    //注意此处的值第一个参数要与发出组件中$emit的第一个参数相同
    EventBus.$on("fireName", (message) => {
      this.newname = message;
    });
  },
};
</script>
